import React, { Component } from 'react'
import { observer } from 'mobx-react/custom'
import AccuseRecordVM from 'cvm/record/accuseRecord'
import './accuseRecord.less'

const AccuseRecordList = observer(({ vm }) => {
  return (
    <div className='accuse-record'>
      {
        vm.accuseRecordDetail.length > 0 ? vm.accuseRecordDetail.map((item, index) => {
          return (
            <div className='flex-wrap common-box' key={index}>
              <div className='flex-3'>
                <p className='title'>{item.CompanyName}</p>
                <p className='tips'>{item.ComplaintTypeStr}-{item.ComplaintDetail}</p>
              </div>
              <div className='flex-2'>
                <p className='money'>￥{item.Deduction.toFixed(2)}</p>
                <p className='time'>{item.CreatedTimeStr}</p>
              </div>
            </div>
          )
        }) : vm.record && <div className='none-record'>
          <img src={require('../../images/none-tousu.png')} />
          <p>暂无客户投诉记录</p>
        </div>
      }
    </div>
  )
})

@observer
class accuseRecord extends Component {
  constructor (props) {
    super(props)
    window.document.title = '客户投诉记录'
    this.vm = new AccuseRecordVM(props)
  }
  render () {
    return (
      <div>
        <AccuseRecordList vm={this.vm} />
      </div>
    )
  }
}

export default accuseRecord
